package pierre_feuille_ciseaux;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

public class Player {
	private String name;
	private int score;
	private List<RPSEnum> moves;
	private int nbOfMoves=10; 
	
	public Player(String name, List<RPSEnum> moves){
		setName(name);
		score=0;
		this.moves = new ArrayList<RPSEnum>();
		setMoves(moves);
	}
	
	public Player(String name){
		setName(name);
		score=0;
		this.moves = new ArrayList<RPSEnum>();
		setMoves();
	}
	
	public void setName(String name){
		this.name = name;
	}
	
	public void setMoves(List<RPSEnum> moves){
		for(int i=0;i<moves.size();i++){
			this.moves.add(moves.get(i));
		}
	}
	
	public void setMoves(){
		Random rand = new Random();
		int nombreAleatoire;
		for(int i=0;i<nbOfMoves;i++){
			nombreAleatoire = rand.nextInt(3);
			if(nombreAleatoire==0){
				this.moves.add(RPSEnum.ROCK);
			}
			if(nombreAleatoire==1){
				this.moves.add(RPSEnum.PAPER);
			}
			if(nombreAleatoire==2){
				this.moves.add(RPSEnum.SCISSOR);
			}
		}
	}
	
	public int getNbOfMoves(){
		return nbOfMoves;
	}
	
	public void setScore(){
		score++;
	}
	
	public String getName(){
		return this.name;
	}
	
	public int getScore(){
		return this.score;
	}
	
	public RPSEnum getNextMove(int i){
		return this.moves.get(i);
	}

}
